<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="app">
        <button @click="change">点击反转字符串</button>
        <p v-text="msg"></p>
        <input type="text" v-model="text" @keyup.enter="changetext">
        <input type="button" value="正常发送" @click="send">
        <ul>
            <li v-for="(item,index) in arr">
                {{index+1}}{{item}}
            </li>
        </ul>

    </div>
    <script src="../vue.js"></script>
    <script>
        const vm = new Vue({
            data: {
                msg: "hello world",
                arr: ["你是笨蛋", "你是傻瓜", "你不要脸"],
                text: "好好学习"
            },
            methods: {
                change() {
                    this.msg = this.msg.split("").reverse().join("")
                },
                send() {
                    this.arr.push(this.text)
                    this.text = ""
                },
                changetext() {
                    this.text = this.text.split("").reverse().join("")
                    this.arr.push(this.text)
                    this.text = ""
                }
            }
        }).$mount('.app')
    </script>
</body>

</html>